import { defineMock } from 'umi';
type userList = {
    id: string;
    name: string;
  };

let userList: userList[] = [
    { id: '1', name: 'Umi' },
    { id: '2', name: 'Ant Design' },
    { id: '3', name: 'Ant Design Pro' },
    { id: '4', name: 'Dva' },
  ];

export default defineMock({
    'GET /api/userList': (_, res) => {
      res.send({
        status: 'ok',
        data: userList,
      });
    },
    'DELETE /api/userList/:id': (req, res) => {
      userList = userList.filter((item) => item.id !== req.params.id);
      res.send({ status: 'ok' });
    },
  });